package cn.gson.crm.control.follow;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.FollowDao;
import cn.gson.crm.model.po.FollowPo;
@WebServlet("/follow/read")
public class FollowReadServlet extends BaseServlet{
	private FollowDao followDao = new FollowDao();
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String nowpage = request.getParameter("anowpage");
		String staffName = request.getParameter("staffname");
		String studentName = request.getParameter("studentname");
		String followRead = request.getParameter("followread");
		int page = followDao.getFollowPageSum(staffName, studentName, followRead);
		request.getSession().setAttribute("pageSum", page);
		if(nowpage == null){
			nowpage = "1";
		}
		List<FollowPo> AllFollowPoList = followDao.getAllFollowPoListByType(Integer.parseInt(nowpage), staffName, studentName, followRead);
		if(AllFollowPoList != null){
			request.setAttribute("AllFollowPoList", AllFollowPoList);
		}
		request.getSession().setAttribute("anowpage", nowpage);
		request.setAttribute("queryString", noPageQueryString());
		forward("follow/follow_read.jsp");
		
	}

}
